const router = require('koa-router')()
const Mock = require('mockjs')

const { list, swiper, menu } = Mock.mock({
  "swiper|4-8": ["@image(375x200, @color, swiper)"],
  "menu|10": [{
    "title": "@ctitle(2)",
    "image": "@image(50x50, @color, menu)"
  }],
  "list|50": [{
    "id": "@id",
    "image": "@image(180x120, @color, item)",
    "title": "@ctitle",
    "price|1-1000": 1,
    "desc": "@cword(10, 30)"
  }]
})

router.get('/swiper', ctx => ctx.body = {
  code: 200,
  data: swiper
})

router.get('/menu', ctx => ctx.body = {
  code: 200,
  data: menu
})

router.get('/list', ctx => ctx.body = {
  code: 200,
  data: list
})


module.exports = router
